<template>
    <div class="mui-numbox" data-numbox-min='1' :data-numbox-max='60'>
		<button class="mui-btn mui-btn-numbox-minus" type="button" @click='change(-1)'>-</button>
		<input id="test" class="mui-input-numbox" type="number"  @change="countChanged" @keydown.enter="chan(value)" ref="num" v-model="value" />
		<button class="mui-btn mui-btn-numbox-plus" type="button" @click="change(1)">+</button>
	</div>
</template>

<script>
import mui from '../../lib/mui/dist/js/mui.js'
import { Toast } from 'mint-ui'
export default {
    data(){
        return{
            // value: 1,
            sub:0
        }
    },
    props:['value','id'],
    mounted(){
        mui('.mui-numbox').numbox()
    },
    methods:{
        countChanged(){
            var obj = {
                id: this.id,
                count: this.value,
                reset: true
            }
            this.$store.commit('addcar',obj)
        },
        change(num){
            var obj = {
                id: this.id,
                count: num,
                reset: true,
                flag : true
            }
            this.$store.commit('addcar',obj)
        },
        chan(num){
            var obj = {
                id: this.id,
                count: num,
                reset: true,
            }
            this.$store.commit('addcar',obj)
        }
    },
    watch:{

    }
}
</script>

<style scoped>

</style>